﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using BLL;
using IFactory;
public partial class UserPlanMonth_MonthPlanDetail : System.Web.UI.Page
{
    Authentication dllAuthentication = new Authentication();

    MonthPlanManager dllMonthPlanManager = new MonthPlanManager();
    protected void Page_Load(object sender, EventArgs e)
    {
        dllAuthentication.isLogin();
        if (!IsPostBack)
        {

            bindMonthPlanGridView();
        }
    }


    /// <summary>
    /// 
    /// </summary>
    void bindMonthPlanGridView()
    {
        object[] _value = new object[1];
        _value[0] = Utility.HttpHelp.getParamsInt("MonthPlanId");
        this.gvlist.DataSource = dllMonthPlanManager.get(MonthPlanManager.field.MonthPlanId.ToString(), _value);
        this.gvlist.DataBind();
        for (int i = 0; i < this.gvlist.Rows.Count; i++)
        {
            wrapByComma(this.gvlist, i, 6);
        }
    }

    /// <summary>
    /// 根据逗号换行事件
    /// </summary>
    void wrapByComma(GridView _gridView, int _rowIndex, int _cells)
    {
        string _content = _gridView.Rows[_rowIndex].Cells[_cells].Text;
        _gridView.Rows[_rowIndex].Cells[_cells].Text = _content.Replace("&lt;br&gt;", "<br>");
        //_gridView.Rows[_rowIndex].Cells[_cells].Text = _content.Replace("&gt;", ">");
        _gridView.Rows[_rowIndex].Cells[_cells].Text = _gridView.Rows[_rowIndex].Cells[_cells].Text.Replace(",", "<br>");


    }

    /// <summary>
    /// 查看月分解
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnMonthDetail_Click(object sender, EventArgs e)
    {
        string _url = "MonthPlanResolveDetail.aspx?_MonthPlanId=" + Utility.HttpHelp.getParamsInt("MonthPlanId");
        Page.RegisterStartupScript("windowsopen", "<script language=javascript>window.open('" + _url + "','MonthPlanResolveDetail','height=200,width=900,top=400,left=80,toolbar=no,menubar=no,scrollbars=yes,resizable=no,location=no,status=no');</script>");
    }
}
